<div class="page-header">
  <% if @user.errors.any? %>
    <div class="alert alert-danger alert-dismissable">
      <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
      <ul>
        <% @user.errors.messages.each do |msg| %>
          <li><%= msg[1].first %></li>
        <% end %>
      </ul>
    </div>
  <% end %>

  <h1>Změna hesla</h1>
</div>

<%= form_for(@user, url: { action: 'update_password', id: @user }, html: { class: "form-horizontal" } ) do |f| %>

  <div class="col-lg-8">

    <% unless current_user.admin? && @user.id != current_user.id%>
    <div class="form-group">
      <%= f.label :current_password, 'Současné heslo', :class => "col-sm-2 control-label" %>
      <div class="col-sm-4">
        <%= f.password_field :current_password, :class => "form-control" %>
      </div>
    </div>
    <% end %>

    <div class="form-group">
      <%= f.label :password, 'Heslo', :class => "col-sm-2 control-label" %>
      <div class="col-sm-4">
        <%= f.password_field :password, :class => "form-control" %>
      </div>
    </div>

    <div class="form-group">
      <%= f.label :password_confirmation, 'Potvrzení hesla', :class => "col-sm-2 control-label" %>
      <div class="col-sm-4">
        <%= f.password_field :password_confirmation, :class => "form-control" %>
      </div>
    </div>

    <div class="form-group">
      <div class="col-sm-offset-2 col-sm-4">
        <%= f.submit 'Změnit heslo', class: 'btn btn-primary' %>
      </div>
    </div>
  </div>
<% end %>
